import java.util.Comparator;
import java.util.PriorityQueue;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * Date: 2024-02-14
 * Time:19:57
 */
public class Solution {
    public static void main(String[] args) {
        Comparator<Integer> maxHeap = new Comparator<Integer>() {
            @Override
            public int compare(Integer o1, Integer o2) {
                return o2.compareTo(o1);  //逆序
            }
        };
        PriorityQueue<Integer> priorityQueue = new PriorityQueue<>(maxHeap);
        priorityQueue.offer(1);
        priorityQueue.offer(3);
        priorityQueue.offer(4);
        priorityQueue.offer(2);
        System.out.println(priorityQueue);
    }
}
